var nowDate = getQueryString("nowDate");
var devId = getQueryString("devId");
$(function () {
    $("#jqGrid").Grid({
        url: '../inspectionrecordingjoin/list?nowDate='+nowDate+"&devId="+devId,
        colModel: [
            {label: '选项编码', name: 'OPTIONCODE', index: 'IO.OPTION_CODE', width: 120},
            {label: '选项名称', name: 'OPTIONNAME', index: ' IO.OPTION_NAME', width: 120},
            {label: '执行人', name: 'AUTHORNAME', index: 'IRJ.PLAN_PERSON', width: 120},
            {label: '执行时间', name: 'INSPECT_DATE', index: 'IRJ.INSPECT_DATE', width: 120,
                formatter: function (value) {
                    return transDate(value, 'yyyy-MM-dd hh:mm:ss');
                }
            },
            {label: '是否正常', name: 'ISNORMAL', index: 'IRJ.IS_NORMAL', width: 80,
                formatter: function (value) {
                    return sysEnums.INSPECTION_STATUS[value];
                }
            },
            {label: '方法标准', name: 'METHODMEANS', index: 'IO.METHOD_MEANS', width: 120},
            {label: '备注信息', name: 'REMARK', index: 'IRJ.REMARK', width: 80},
            {label: 'id', name: 'id', key: true, hidden: true},
        ]
    });
});

let vm = new Vue({
    el: '#rrapp',
    data: {
        showList: true,
        title: null,
        q: {
            name: ''
        }
    },
    methods: {
        query: function () {
            vm.reload();
        },

        reload: function (event) {
            vm.showList = true;
            let page = $("#jqGrid").jqGrid('getGridParam', 'page');
            $("#jqGrid").jqGrid('setGridParam', {
                postData: {'name': vm.q.name},
                page: page
            }).trigger("reloadGrid");
            vm.handleReset('formValidate');
        },
        reloadSearch: function () {
            vm.q = {
                name: ''
            };
            vm.reload();
        },
        handleSubmit: function (name) {
            handleSubmitValidate(this, name, function () {
                vm.saveOrUpdate()
            });
        },
        handleReset: function (name) {
            handleResetForm(this, name);
        }
    }
});
